package com.scheduler.utils.trace;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

public class LocalTrace {

    private static final ThreadLocal<TraceParam> traceThreadLocal = new ThreadLocal<>();

    public static void clean() {
        traceThreadLocal.remove();
    }

    public static TraceParam get() {
        return traceThreadLocal.get();
    }

    public static void set(TraceParam traceParam) {
        traceThreadLocal.set(traceParam);
    }


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class TraceParam {
        private String traceId;
    }

}
